package org.checkboo.hopefullyengine.light;

import java.nio.FloatBuffer;

import org.checkboo.hopefullyengine.sceneelements.Color;
import org.checkboo.math.Matrix44f;
import org.checkboo.math.Vector3f;
import org.lwjgl.BufferUtils;

public class PointLight extends Light{
	
	private Vector3f position;
	private FloatBuffer pos;
	
	public PointLight(){
		super();
		this.position = new Vector3f(0.0f, 0.0f, 0.0f);
	}
	
	public PointLight(Color diffuse, Color specular, Color ambient, Vector3f position){
		super(diffuse, specular, ambient);
		this.position = position;
	}

	public Vector3f getPosition() {
		return position;
	}
	
	public FloatBuffer getPositionBuffer(){
		if(null == pos)
			pos = BufferUtils.createFloatBuffer(4);
		pos.put(this.position.getX()).put(this.position.getY()).put(this.position.getZ()).put(1.0f).rewind();
		return pos;
	}

	public void setPosition(Vector3f position) {
		this.position = position;
	}
	
	public Matrix44f getTransform(){
		Matrix44f tmp = new Matrix44f();
		tmp.identity();
		tmp.translate(this.position);
		return tmp;
	}
}
